package c3au;

import java.awt.BorderLayout;

import javax.swing.DefaultListModel;
import javax.swing.JList;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.border.CompoundBorder;
import javax.swing.border.TitledBorder;

public class PanelListaTramas extends JPanel{

	private InterfazCentroMonitoreo interfaz;
	private JList listaTramas;
	private JScrollPane scroll;
	private DefaultListModel tramas;
	
	
	public PanelListaTramas(InterfazCentroMonitoreo inter)
	{
		interfaz=inter;
		setLayout(new BorderLayout());
		setBorder(new TitledBorder("Tramas recibidas"));
		
		tramas=new DefaultListModel();
		listaTramas=new JList(tramas);
		scroll= new JScrollPane(listaTramas);
		scroll.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		scroll.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED);
		
		add(scroll,BorderLayout.CENTER);
	}
	
	public void actualizarLista(String nuevaTrama)
	{
		System.out.println("Entra a actualizar");
		tramas.addElement(nuevaTrama);
	}
	
	
}
